package response

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
)

type uniResp struct {
	jsonResp *ApiResp
	tplResp  *TplResp
}

func UniResp(r *ghttp.Request, message string, path string) {

	resp := uniResp{}
	if r.IsAjaxRequest() {
		resp.jsonResp = CommonResp(r)
		resp.jsonResp.SetErrorJsonExit(message)
	} else {
		resp.tplResp = BuildTpl(r, "public/jump.html")
		resp.tplResp.WriteTplWithExit(g.MapStrAny{
			"msg":  message,
			"path": path,
		})

	}
}
